'use strict';
var http = require("http");//导入http模块

//创建http server,并传入回调函数
var server = http.createServer(function (req,res) {//回调函数接收request和response对象
	//获取http请求的method和url
	console.log(req.method+":"+req.url);

	//将http响应状态码200写入response,同时设置Content-Type:text/html
	res.writeHead(200,{"Content-Type":"text/html"});

	res.end('<h1>Hello World</h1>');
});

server.listen(6060);//让服务监听6060端口

console.log("Server is running at http:127.0.0.1:6060/");